﻿using System.Data.Common;
namespace Library.OrmEnterpriseEntity.Factor {
	///<summary>
	/// Excute context for specific DBMS
	///</summary>
	public interface IDbContext : IServiceContext, IConnectionCreator {
		/// <summary>
		/// Excute select statement and return Datareader
		/// </summary>
		/// <param name="selectStatement"></param>
		/// <returns></returns>
		DbDataReader ExcuteStatement(SelectStatementWrapper selectStatement);
		/// <summary>
		/// Excute delete statement and return total rows deleted
		/// </summary>
		/// <param name="statement"></param>
		/// <returns>Total row deleted</returns>
		int ExcuteStatement(DeleteStatementWrapper statement);
		/// <summary>
		/// Excute update statement and return total rows updated
		/// </summary>
		/// <param name="statement"></param>
		/// <returns>Total rows updated</returns>
		int ExcuteStatement(UpdateStatementWrapper statement);
		/// <summary>
		/// Current row type for one session(All thread)
		/// </summary>
		short GlobalRowType { get; set; }
		/// <summary>
		/// Change row type for current scope
		/// </summary>
		/// <param name="rowType"></param>
		/// <returns></returns>
		RowTypeChangable ChangeRowType(short rowType);
		/// <summary>
		/// String resource for Persitent entity
		/// </summary>
		IStringResource StringResource { get; }
	}
}
